function initIndentModel(sequelize, DataTypes) {
    const Indent = sequelize.define('indent', {
        iid: {
            type: DataTypes.INTEGER,
            primaryKey: true,
            autoIncrement: true,
            field: 'iid'
        },
        uid: {
            type: DataTypes.INTEGER,
            allowNull: false,
            field: 'uid',
            comment: '用户id'
        },
        tid: {
            type: DataTypes.INTEGER,
            allowNull: false,
            field: 'tid',
            comment: '门票id'
        },
        jid: {
            type: DataTypes.INTEGER,
            allowNull: false,
            field: 'jid',
            comment: '景点id'
        },
        quantity: {
            type: DataTypes.INTEGER,
            allowNull: false,
            defaultValue: 1,
            comment: '购买数量'
        },
        totalPrice: {
            type: DataTypes.DECIMAL(10, 2),
            allowNull: false,
            field: 'totalPrice',
            comment: '总价格'
        },
        status: {
            type: DataTypes.ENUM('pending', 'paid', 'cancelled', 'completed'),
            defaultValue: 'pending',
            comment: '订单状态'
        },
        payAt: {
            type: DataTypes.DATE,
            field: 'payAt',
            comment: '支付时间'
        }
    }, {
        tableName: 'indent',
        timestamps: false
    });
    
    return Indent;
}

module.exports = initIndentModel;